package cn.labbook.bluetooth.entity.excel;

import cn.labbook.bluetooth.common.TokenManager;
import cn.labbook.bluetooth.constant.AmmeterConstant;
import cn.labbook.bluetooth.entity.Ammeter;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class AmmeterTemplate {
    private String adminId;
    private String ammeterId;
    public static AmmeterTemplate build(Ammeter ammeter) {
        AmmeterTemplate ammeterTemplate = new AmmeterTemplate();
        ammeterTemplate.setAdminId(ammeter.getAdminId());
        ammeterTemplate.setAmmeterId(TokenManager.getToken().getAdminId());
        return ammeterTemplate;
    }
    public Ammeter buildAmmeter(AmmeterTemplate ammeterTemplate){
        Ammeter ammeter = new Ammeter();
        ammeter.setAmmeterId(ammeterTemplate.getAmmeterId());
        ammeter.setAdminId(ammeterTemplate.getAdminId());
        ammeter.setStatus(AmmeterConstant.NOTACTIVATE);
        return ammeter;
    }
}
